package com.easy.neo4j.resolver;

import com.easy.common.util.Result;
import com.easy.common.util.Tools;
import com.easy.neo4j.exception.CheckParamException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-19 19:44
 **/
@ControllerAdvice

public class ExceptionResolver {
    //处理参数异常
    @ExceptionHandler(value = CheckParamException.class)
    @ResponseBody
    public String checkoutExceptionResolver(CheckParamException ex) {
        return Tools.object2Json(Result.error(ex.getException()));
    }
}
